home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / var / lib / dpkg / info / libssl0.9.8.postinst < prev    next >
Encoding:
Text File  |  2012-05-16  |  5.0 KB  |  175 lines

  1. #!/bin/bash
  2.  
  3. . /usr/share/debconf/confmodule
  4.  
  5. set -e
  6.  
  7. package_name()
  8. {
  9.     echo $(basename $0 .postinst)
  10. }
  11.  
  12. # element() is a helper function for file-rc:
  13. element() {
  14.     local element list IFS
  15.  
  16.     element="$1"
  17.  
  18.     [ "$2" = "in" ] && shift
  19.     list="$2"
  20.     [ "$list" = "-" ] && return 1
  21.     [ "$list" = "*" ] && return 0
  22.  
  23.     IFS=","
  24.     set -- $list
  25.     case $element in
  26.     "$1"|"$2"|"$3"|"$4"|"$5"|"$6"|"$7"|"$8"|"$9")
  27.         return 0
  28.     esac
  29.     return 1
  30. }
  31.  
  32. # filerc (runlevel, service) returns /etc/init.d/service, if service is
  33. # running in $runlevel:
  34. filerc() {
  35.     local runlevel basename
  36.     runlevel=$1
  37.     basename=$2
  38.     while read LINE
  39.     do
  40.     case $LINE in
  41.         \#*|"") continue
  42.     esac
  43.  
  44.     set -- $LINE
  45.     SORT_NO="$1"; STOP="$2"; START="$3"; CMD="$4"
  46.     [ "$CMD" = "/etc/init.d/$basename" ] || continue
  47.  
  48.     if element "$runlevel" in "$START" || element "S" in "$START"
  49.     then
  50.         echo "/etc/init.d/$basename"
  51.         return 0
  52.     fi
  53.     done < /etc/runlevel.conf
  54.     echo ""
  55. }
  56.  
  57. if [ "$1" = "configure" ]
  58. then
  59.     if [ ! -z "$2" ]; then
  60.     if dpkg --compare-versions "$2" lt 0.9.8g-9 && dpkg --compare-versions "$2" gt 0.9.8c-4etch3; then
  61.         db_version 2.0
  62.  
  63.         echo -n "Checking for services that may need to be restarted..."
  64.  
  65.         check="sendmail openssh-server"
  66.         check="$check apache2-common ssh-nonfree exim4"
  67.         check="$check apache-ssl libapache-mod-ssl openvpn spamassassin"
  68.         check="$check courier-imap-ssl courier-mta-ssl courier-pop-ssl"
  69.         check="$check postfix cyrus21-imapd cyrus21-pop3d"
  70.         check="$check postgresql-7.4 postgresql-8.0 postgresql-8.1"
  71.         check="$check postgresql-8.2"
  72.         check="$check racoon dovecot-common bind9"
  73.         check="$check ntp openntpd clamcour nagios-nrpe-server"
  74.         check="$check clamav-freshclam clamav-daemon"
  75.         check="$check fetchmail ftpd-ssl slapd"
  76.         check="$check proftpd proftpd-ldap proftpd-mysql proftpd-pgsql"
  77.         check="$check partimage-server conserver-server tor"
  78.         check="$check stunnel4"
  79.         # Only get the ones that are installed, and configured
  80.         check=$(dpkg -s $check 2> /dev/null | egrep '^Package:|^Status:' | awk '{if ($1 ~ /^Package:/) { package=$2 } else if ($0 ~ /^Status: .* installed$/) { print package }}')
  81.         # apache2 ships its init script in apache2-common, but the
  82.         # script is apache2
  83.         check=$(echo $check | sed 's/apache2-common/apache2/g')
  84.         # For mod-ssl apache has to be restarted
  85.         check=$(echo $check | sed 's/libapache-mod-ssl/apache/g')
  86.         # The name of proftpd-{ldap,mysql,pgsql} init script is
  87.         # same as "proftpd".
  88.         check=$(echo $check | sed 's/proftpd-.*/proftpd/g')
  89.             # dovecot-common ships its init script, but the
  90.         # script name is dovecot for dovecot-{imapd,pop3d}.
  91.         check=$(echo $check | sed 's/dovecot-common/dovecot/g')
  92.         # openssh-server's init script it called ssh
  93.         check=$(echo $check | sed 's/openssh-server/ssh/g')
  94.         echo "done."
  95.  
  96.         echo "Checking init scripts..."
  97.         for service in $check; do
  98.         if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
  99.            idl=$(ls /etc/init.d/${service} 2> /dev/null | head -n 1)
  100.            if [ -n "$idl" ] && [ -x $idl ]; then
  101.             services="$service $services"
  102.            else
  103.             echo "WARNING: init script for $service not found."
  104.            fi
  105.         else
  106.             if [ -f /usr/share/file-rc/rc ] || [ -f /usr/lib/file-rc/rc ] && [ -f /etc/runlevel.conf ]; then
  107.  
  108.             idl=$(filerc $rl $service)
  109.             else
  110.             idl=$(ls /etc/rc${rl}.d/S??${service} 2> /dev/null | head -n 1)
  111.             fi
  112.             if [ -n "$idl" ] && [ -x $idl ]; then
  113.                 services="$service $services"
  114.             fi
  115.         fi
  116.         done
  117.         if [ -n "$services" ]; then
  118.         db_reset libssl0.9.8/restart-services
  119.         db_set libssl0.9.8/restart-services "$services"
  120.         db_input critical libssl0.9.8/restart-services || true
  121.         db_go || true
  122.         db_get libssl0.9.8/restart-services
  123.         
  124.         if [ "x$RET" != "x" ]
  125.         then
  126.             services=$RET
  127.             answer=yes
  128.         else
  129.             answer=no
  130.         fi
  131.         echo
  132.         if [ "$answer" = yes ] && [ "$services" != "" ]; then
  133.             echo "Restarting services possibly affected by the upgrade:"
  134.             failed=""
  135.             rl=$(runlevel | sed 's/.*\ //')
  136.             for service in $services; do
  137.             if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
  138.                 idl="invoke-rc.d ${service}"
  139.             elif [ -f /usr/share/file-rc/rc ] || [ -f /usr/lib/file-rc/rc ] && [ -f /etc/runlevel.conf ]; then
  140.                 idl=$(filerc $rl $service)
  141.             else
  142.                 idl=$(ls /etc/rc${rl}.d/S??${service} 2> /dev/null | head -n 1)
  143.             fi
  144.  
  145.             if ! $idl restart; then
  146.                 failed="$service $failed"
  147.             fi
  148.             done
  149.             echo
  150.             if [ -n "$failed" ]; then
  151.             db_subst libssl0.9.8/restart-failed services "$failed"
  152.             db_input critical libssl0.9.8/restart-failed || true
  153.             db_go || true
  154.             else
  155.             echo "Services restarted successfully."
  156.             fi
  157.             echo
  158.         fi
  159.         else
  160.         echo "Nothing to restart."
  161.         fi
  162.         # Shut down the frontend, to make sure none of the
  163.         # restarted services keep a connection open to it
  164.         db_stop
  165.     fi # end upgrading and $2 lt 0.9.8c-2
  166.     fi # Upgrading
  167. fi
  168.  
  169. # Automatically added by dh_makeshlibs
  170. if [ "$1" = "configure" ]; then
  171.     ldconfig
  172. fi
  173. # End automatically added section
  174.  
  175.